home *** CD-ROM | disk | FTP | other *** search
- OMP_LOCK(3) Last changed: 2-24-98
-
-
- NNAAMMEE
- oommpp__iinniitt__lloocckk, oommpp__ddeessttrrooyy__lloocckk, oommpp__sseett__lloocckk, oommpp__uunnsseett__lloocckk,
- oommpp__tteesstt__lloocckk, OOMMPP__IINNIITT__LLOOCCKK, OOMMPP__DDEESSTTRROOYY__LLOOCCKK, OOMMPP__SSEETT__LLOOCCKK,
- OOMMPP__UUNNSSEETT__LLOOCCKK, OOMMPP__TTEESSTT__LLOOCCKK, - Set of procedures to manipulate
- locks
-
- SSYYNNOOPPSSIISS
- C/C++: (Deferred implementation)
- ##iinntteeggeerr <<oommpp__iinniitt__lloocckk>>
- vvooiidd oommpp__iinniitt__lloocckk((_v_a_r))
-
- ##iinntteeggeerr <<oommpp__ddeessttrrooyy__lloocckk>>
- vvooiidd oommpp__ddeessttoorryy__lloocckk((_v_a_r))
-
- ##iinntteeggeerr <<oommpp__sseett__lloocckk>>
- vvooiidd oommpp__sseett__lloocckk((_v_a_r))
-
- ##iinntteeggeerr <<oommpp__uunnsseett__lloocckk>>
- vvooiidd oommpp__uunnsseett__lloocckk((_v_a_r))
-
- ##iinntteeggeerr <<oommpp__tteesstt__lloocckk>>
- iinntt oommpp__tteesstt__lloocckk((_v_a_r))
-
- Fortran:
- CCAALLLL OOMMPP__IINNIITT__LLOOCCKK((_v_a_r))
-
- CCAALLLL OOMMPP__DDEESSTTRROOYY__LLOOCCKK((_v_a_r))
-
- CCAALLLL OOMMPP__SSEETT__LLOOCCKK((_v_a_r))
-
- CCAALLLL OOMMPP__UUNNSSEETT__LLOOCCKK((_v_a_r))
-
- LLOOGGIICCAALL OOMMPP__TTEESSTT__LLOOCCKK((_v_a_r))
-
- IIMMPPLLEEMMEENNTTAATTIIOONN
- IRIX systems
-
- SSTTAANNDDAARRDDSS
- OpenMP Fortran API
-
- DDEESSCCRRIIPPTTIIOONN
- The following descriptions contain information for Fortran and C/C++.
-
- oommpp__iinniitt__lloocckk, OOMMPP__IINNIITT__LLOOCCKK
- This subroutine initializes a lock associated with the lock
- variable _v_a_r for use in subsequent calls.
-
- The initial state is unlocked. The lock variable must only be
- accessed through these routines. In this and the following lock
- routines, _v_a_r should be a scalar integer variable in C and of
- type integer in Fortran and must have a size large enough to hold
- an address. For example, for 64-bit addressable systems, the
- variable must at least by declared as IINNTTEEGGEERR**88.
-
- oommpp__ddeessttoorryy__lloocckk, OOMMPP__DDEESSTTRROOYY__LLOOCCKK
- This procedure disassociates the given lock variable _v_a_r from any
- locks.
-
- oommpp__sseett__lloocckk, OOMMPP__SSEETT__LLOOCCKK
- This procedure constrins the executing thread to wait until the
- specified lock is available. The thread is granted ownership of
- the lock when it is available.
-
- oommpp__uunnsseett__lloocckk, OOMMPP__UUNNSSEETT__LLOOCCKK
- This procedure releases the executing thread from ownership of
- the lock. The behavior is undefined if the thread does not own
- that lock.
-
- oommpp__tteesstt__lloocckk, OOMMPP__TTEESSTT__LLOOCCKK
- This function tries to set the lock associated with the lock
- variable _v_a_r. It returns nnoonn--zzeerroo (TTRRUUEE) if the lock is
- successfully set; otherwise, it returns zzeerroo (FFAALLSSEE).
-
- EEXXAAMMPPLLEESS
- In the following Fortran 90 example, the argument to the lock routines
- should be of size PPOOIINNTTEERR:
-
- PROGRAM LOCK_USAGE
- EXTERNAL OMP_TEST_LOCK
- LOGICAL OMP_TEST_LOCK
-
- INTEGER LCK ! THIS VARIABLE SHOULD BE POINTER SIZED
-
- CALL OMP_INIT_LOCK(LCK)
- !$OMP PARALLEL SHARED(LCK) PRIVATE(ID)
- ID = OMP_GET_THREAD_NUM()
- CALL OMP_SET_LOCK(LCK)
- PRINT *, 'MY THREAD ID IS ', ID
- CALL OMP_UNSET_LOCK(LCK)
-
- DO WHILE (.NOT. OMP_TEST_LOCK(LCK))
- CALL SKIP(ID) ! WE DO NOT YET HAVE THE LOCK
- ! SO WE MUST DO SOMETHING ELSE
- END DO
-
- CALL WORK(ID) ! WE NOW HAVE THE LOCK
- ! AND CAN DO THE WORK
- CALL OMP_UNSET_LOCK( LCK )
- !$OMP END PARALLEL
-
- CALL OMP_DESTROY_LOCK( LCK )
-
- END
-
- SSEEEE AALLSSOO
- oommpp__nneesstteedd(3) to manipulate or report status of nested parallelism,
-
- oommpp__tthhrreeaaddss(3) for runtime library procedures used to set, call or
- return numbers of threads
-
- This man page is available only online.
-